package com.plian.system.dao.fr.bulletin;

import com.plian.Tools.pagedata.PageData;
import com.plian.system.dao.DaoSupport;
import com.plian.system.model.page.Page;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
public class BulletinDao {

    @Resource(name = "daoSupport")
    private DaoSupport dao;

    /**
     * 新增
     *
     * @param pd
     * @throws Exception
     */
    public void save(PageData pd) throws Exception {
        dao.save("BulletinMapper.save", pd);
    }
    /**
     * 删除
     *
     * @param
     * @throws Exception
     */
    public void delete(PageData pd) throws Exception {
        dao.delete("BulletinMapper.delete", pd);
    }
    public PageData findById(PageData pd) throws Exception {
        return (PageData) dao.findForObject("BulletinMapper.findById", pd);
    }

    public PageData findByDate(PageData pd) throws Exception {
        return (PageData) dao.findForObject("BulletinMapper.findByDate", pd);
    }
    public List<PageData> findListByDate(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BulletinMapper.findListByDate", pd);
    }

    public List<PageData> findListByOrgId(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BulletinMapper.findListByOrgId", pd);
    }

    public List<PageData> getFinancialDate(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BulletinMapper.getFinancialDate", pd);
    }
    public List<PageData> getGorupFinancialDate(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BulletinMapper.getGorupFinancialDate", pd);
    }
    /*预警分析获取默认时间*/
    public PageData getDefaultTime(PageData pd) throws Exception {
        return (PageData) dao.findForObject("BulletinMapper.getDefaultTime", pd);
    }
    public PageData getCountByDate(PageData pd) throws Exception {
        return (PageData) dao.findForObject("BulletinMapper.getCountByDate", pd);
    }
    public PageData findSumByDate(PageData pd) throws Exception {
        return (PageData) dao.findForObject("BulletinMapper.findSumByDate", pd);
    }
    public List<PageData> list(Page page) throws Exception {
        return (List<PageData>) dao.findForList("BulletinMapper.datalistPage", page);
    }
    public List<PageData> listByCondition(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BulletinMapper.listByCondition", pd);
    }
    public List<PageData> getList(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BulletinMapper.getList", pd);
    }
    /*
   上报
    */
    public void refer(PageData pd) throws Exception {
        dao.update("BulletinMapper.refer", pd);
    }
    /*
       上报
        */
    public void edit(PageData pd) throws Exception {
        dao.update("BulletinMapper.edit", pd);
    }

    public List<PageData> findByIds(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BulletinMapper.findByIds", pd);
    }
    /**
     * 批量删除
     *
     * @throws Exception
     */
    public void deleteAll(PageData pd) throws Exception {
        dao.delete("BulletinMapper.deleteAll", pd);
    }
    /*
    获取快报已填月份
     */
    public List<Integer> findFilledMonth(PageData pd) throws Exception {
        return (List<Integer>) dao.findForList("BulletinMapper.findFilledMonth", pd);
    }

    /**
     * 根据时间段返回快报
     * @param
     * @return
     * @throws Exception
     */
    public List<PageData> findListByDateRange(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BulletinMapper.findListByDateRange", pd);
    }

    /**
     * 根据 填报时间  单位id 返回快报
     * @param pd
     * @return
     * @throws Exception
     */
    public List<PageData> summaryChildList(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BulletinMapper.summaryChildList", pd);
    }

    public PageData summaryByIds(PageData pd) throws Exception{
        return (PageData) dao.findForObject("BulletinMapper.summaryByIds", pd);
    }

    /**
     * 获取合计明细
     * @param pd
     * @return
     * @throws Exception
     */
    public List<PageData> getSummaryDetail(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BulletinMapper.getSummaryDetail", pd);
    }

}
